using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.IO;

namespace blogapi
{
    public partial class pridej : Form
    {
        public pridej(pages pb,nastaveni nast)
        {
            InitializeComponent();
            pp = pb;
            nas = nast;
            setlang();
        }

        nastaveni nas;
        pages pp;
        private void menuItem1_Click(object sender, EventArgs e)
        {
            this.Hide();
        }

        public void Clear()
        {
            textBox1.Text="";
            textBox2.Text = "";
            textBox3.Text = "";
            comboBox1.SelectedIndex = 0;
            checkBox1.Checked = true;
        }

        private void menuItem2_Click(object sender, EventArgs e)
        {
            if (textBox1.Text == "" || comboBox1.SelectedIndex == -1)
            { 
                MessageBox.Show(nas.getlang("nevyplnenepoleucet"),nas.getlang("chybneudaje"));
                return;
            }
            blogs blg = new blogs();
            blg.pass = textBox3.Text;
            blg.url = textBox1.Text;
            blg.user = textBox2.Text;
            blg.type = comboBox1.SelectedIndex;
            blg.vybrat = checkBox1.Checked;
            pp.mozn.Add(blg);
            pp.nacti();
            MessageBox.Show(nas.getlang("uspesnepridano"),nas.getlang("pridaniuspe"));
            this.Hide();
        }

        public void setlang()
        {
            menuItem1.Text = nas.getlang("zpet");
            menuItem2.Text = nas.getlang("pridat");
            label1.Text = nas.getlang("urlblog");
            label2.Text = nas.getlang("username");
            label3.Text = nas.getlang("pass");
            label4.Text = nas.getlang("protokol");
            label5.Text = nas.getlang("pripub");
            checkBox1.Text = nas.getlang("serverautsel");
            Text = "W - "+nas.getlang("newucetadd");
        }

    }
}